package com.situ.student.controller;

import java.util.List;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.situ.student.entity.Banji;
import com.situ.student.service.IBanjiService;
import com.situ.student.service.impl.BanjiServiceImpl;

/**
 * 和班级相关的Controller
 * 
 * @author The sky
 *
 */
public class BanjiController extends HttpServlet {
	private IBanjiService banjiService = new BanjiServiceImpl();

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		List<Banji> list = banjiService.list();
		for (Banji banji : list) {
			System.out.println(banji);
		}
		// 将list放到req中
		req.setAttribute("list", list);
		// 转发到Banji_list.jsp页面展示
		req.getRequestDispatcher("/banji_html_list.jsp").forward(req, resp);
	}

}
